#!/usr/bin/env python
# coding: utf-8

# In[27]:


import cv2
from matplotlib import pyplot as plt


# In[28]:


im1=cv2.imread(r"C:\Users\yun\Desktop\test\1.jpg")


# In[29]:


im2=cv2.imread(r"C:\Users\yun\Desktop\test\2.jpg")


# In[30]:


orb=cv2.ORB_create()


# In[31]:


keypoints1, dest1 = orb.detectAndCompute(im1, None)


# In[32]:


keypoints2, dest2 = orb.detectAndCompute(im2, None)


# In[33]:


bf=cv2.BFMatcher(cv2.NORM_HAMMING, crossCheck = False)


# In[34]:


matches=bf.knnMatch(dest1, dest2, k = 2)


# In[35]:


im3 = cv2.drawMatchesKnn(im1, keypoints1, im2, keypoints2, matches[:30], None, flags = 2)


# In[36]:


plt.imshow(im3)


# In[ ]:




